package com.hxkj.domain.enums;

import com.platform.common.domain.exception.CustomExceptionCode;
import sun.security.util.Length;

/**
 * @EnumName TagsExceptionEnum
 * @Description TODO
 * @Author Mr.zheng
 * @Date 2018/6/7 11:42
 * @Version 1.0
 */
public enum TagsExceptionEnum implements CustomExceptionCode {

    TAGS_IS_EXIST(300, "名称已存在", 900),
    TAGS_NOT_EXIST(301, "名称不存在", 900),
    TAGS_SAVE_ERROE(302, "添加标签失败", 900),
    TAGS_DELETE_ERROE(303,"删除标签失败",900),
    TAGS_UPDATE_ERROE(304,"修改标签失败",900),
    TAGS_NOT_VOID(305,"标签信息不能为空",900),
    TAGS_NOT_NAME(306,"标签名称不能为空",900),
    TAGS_NOT_SITEID(307,"站点ID为空",900),
    TAGS_NAME_NOT_ARTICLE(308,"此标签没有搜索到文章",900),
    TAGS_NAME_IS_LENGTH(309,"标签名称长度超出，请填写四个字的中文的标签",900),
    TAGS_TAGTEMPLE_FREEMARKER_ERRO(310, "TAG详情标签模板解析失败", 900),
    TAGS_TAGTEMPLET_NOT_EXIST(311, "TAG详情标签模板不存在", 900),
    TAGS_TEMPLET_NOT_EXIST(312, "TAG聚合标签模板不存在", 900),
    TAGS_TAGTEMPLET_NOT_NULL(313, "请选择TAG详情标签模板哦", 900),
    TAGS_TEMPLET_NOT_NULL(314, "请选择TAG聚合标签模板哦", 900),
    TAGS_TEMPLET_FREEMARKER_ERRO(315, "TAG聚合标签模板解析失败", 900),
    ;
    private Integer code;
    private String msg;
    private Integer httpCode;

    TagsExceptionEnum(Integer code, String msg, Integer httpCode) {
        this.code = code;
        this.msg = msg;
        this.httpCode = httpCode;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public Integer getHttpCode() {
        return httpCode;
    }

    @Override
    public void setHttpCode(Integer httpCode) {
        this.httpCode = httpCode;
    }

    public static TagsExceptionEnum getEnumByCode(Integer code){
        for(TagsExceptionEnum tagsExceptionEnum : TagsExceptionEnum.values()){
            if(code.equals(tagsExceptionEnum.getCode())){
                return tagsExceptionEnum;
            }
        }
        return null;
    }
}
